﻿#pragma once

#include "spdlog/spdlog.h"
#include "spdlog/sinks/daily_file_sink.h"
#include "spdlog/fmt/ostr.h"
extern std::shared_ptr<spdlog::logger> logger ;

#include <QDialog>
#include <QPushButton>
#include "QFileDialog"
#include "QMessageBox"
#include "QApplication"
#include "QGridLayout"
#include "QVBoxLayout"
#include "QLabel"
#include "QSpinBox"
#include "show_qlabel.h"
#include "QComboBox"
#include "QTableWidget"

#include "opencv2/opencv.hpp"
using namespace cv;
using namespace std;

#include <fstream>
//#include "nlohmann/json.hpp"
//using json = nlohmann::json;

#include "commonfunction.h"
extern QImage matToQImage(const Mat mat_in);

#include "camera_dalsa.h"
#include <QSettings>
class CameraBaseQDialog : public QDialog
{
    Q_OBJECT

public:
    //QTableWidget m_qtablewidget;
	QSettings* m_qsettings;

    QString m_SN;//相机的SN
    int m_camera_index;
    QString m_camera_name;//相机的名字
    QString m_camera_type;//相机类型
    QString m_image_dir;//

    QString m_type;


	
	QDoubleSpinBox* m_doubleqspinbox_ExposureTime;
	double ExposureTime = 0;

	
	QDoubleSpinBox* m_doubleqspinbox_Gain;
	double Gain = 0;

	
	QSpinBox* m_qspinbox_Width;
	int Width = 0;

	QSpinBox* m_qspinbox_Height;
	int Height = 0;

	QSpinBox* m_qspinbox_OffsetX = nullptr;
	int OffsetX = 0;

	QSpinBox* m_qspinbox_OffsetY = nullptr;
	int OffsetY = 0;

	QDoubleSpinBox* m_doubleqspinbox_AcquisitionLineRate = nullptr;
	double AcquisitionLineRate = 1000;


    QPushButton* m_qpushbutton_save;
    QPushButton* m_qpushbutton_hide;


    cv::Mat m_image ;
    QString m_path_para = "prar.json";
    QString m_section   = "error";

    CameraDalsa* m_camera_interface = nullptr;
public:
    explicit CameraBaseQDialog(QDialog *parent,  QString dir, int camera_index);
    bool initCamera(QString name,CameraCallback pfunction, void *pcontext);
    void loadParameter();
    void saveParameter();
    void showImage(Mat image,int camera_index,int index);
    void softTrigger();
    virtual void closeEvent(QCloseEvent *event);


};
#pragma execution_character_set("utf-8")
